<?php


namespace App\Models;


class userModel extends BaseModel
{
    protected $tableName = 'school_user';
    const UPDATED_AT = null;

    public function addInfo($data)
    {
        if (isset($data['uid']) && $data['uid'] && is_numeric($data['uid'])) {
            $uid = $data['uid'];
            unset($data['uid']);
            $this->getQueryBuilder()->where('uid',$uid)->update($data);
            return $uid;
        }else{
//            x($data);
            return $this->getQueryBuilder()->insertGetId($data);
        }
    }

    /**
     * 获取用户信息
     * @param $openid
     * @return mixed
     */
        public function searchDataType($openid){

        return $this->getQueryBuilder()->where('openid',$openid)->first();
    }
}